<%@page import="java.util.List"%>
<%@page import="com.gym.model.entity.User"%>
<%@page import="com.gym.model.entity.Trainer"%>
<%@page import="com.gym.model.entity.Course"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="/jsp/menu.jsp" />
<link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>listaTrainer</title>
</head>
<%
User user = (User)session.getAttribute("user");
List<Trainer> listaTrainer = (List<Trainer>) request.getAttribute("listaTrainer");
String feedback = (String)request.getAttribute("feedback");
List<Course> listaCourse = (List<Course>) request.getAttribute("course");
%>
<body>
<br><br>
	
<%
if(session.getAttribute("TrainerCancellato") != null){
	Trainer trainer = (Trainer) session.getAttribute("TrainerCancellato");
%>
	<div style="padding-bottom: 2%;text-align: center; font-size: 20px;">
		<a href="ripristinaTrainer.do">Ripristina trainer '<%=trainer.getTrainerfirstname()+" "+trainer.getTrainerlastname()%>'?</a>
	</div> &nbsp;
	
	<%if(feedback != null){%>
		<strong style="color:black;"><%=feedback%> : 
		<%
		for(Course c : listaCourse )
		{%>
			<%=c.getActivity()%> &nbsp;
		<%}
		%></strong>
	<%}%> <br><br>
<%}%>

<table>
	<tr>
		<th>TRAINER</th>
		<th>PHONE NUMBER</th>
		<th>SKILL</th>
		<%if(user != null && user.isAdmin()){%>
			<th>ELIMINA</th>
			<th>MODIFICA</th>
		<%}%>
	</tr>
	<%for(Trainer t : listaTrainer) {%>
	<tbody>
	<tr>
		<td>
			<a href="schedaTrainer.do?id=<%=t.getId()%>"> 
				<%=t.getTrainerfirstname()+" "+t.getTrainerlastname()%> 
			</a>
		</td>
		<td><%=t.getTrainerphone()%></td>
		<td><%=t.getTrainerskill()%></td>
		
		<%if(user != null && user.isAdmin()){%>
			<td align="center"><a href="deleteTrainer.do?id=<%=t.getId()%>"><img src="elimina-icon.png" width="24" height="24"></a></td>
			<td align="center"><a href="dominiUpdateTrainer.do?id=<%=t.getId()%>"><img src="icon-modifica.png" width="24" height="24"></a></td>
		<%}%>
	</tr>
	</tbody>
	<%}%>

</table>

</body>
</html>